package hilos;
public class BloquesSincronizados {
     public static void main(String[] args) throws InterruptedException {
        //Object o = new Object();
        //o.wait();
        
         Monitor m = new Monitor();
         m.funcion1();

         Monitor m2 = new Monitor();
         m2.funcion1();

         synchronized(m){
             
         }
         
         String sincronismo = new String();
         synchronized(sincronismo){
            sincronismo.wait();
            sincronismo.notify();
         }
         
     }
     static class Monitor{
        public synchronized void funcion1() throws InterruptedException{
            wait();
        }
        public synchronized void despertar(){
            notify();
        }
        public void funcion2(){
            //sfdgsfdg
            synchronized(this){
                notify();
            }
            //sfdfgsfd
        }
     }
     

}
